﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Web.Mvc;
using TN_CMS.Framework.Variable;

namespace TN_CMS.Domain.Entities
{
    public class SysFeature
    {
        public SysFeature()
        {
            SysRoles = new HashSet<SysRole>();
            Childrens = new HashSet<SysFeature>();
        }

        [ScaffoldColumn(false)]
        public int Id { get; set; }

        [Required]
        [UIHint("TNText")]
        public string Name { get; set; }

        [Required]
        [UIHint("TNText")]
        public string Title { get; set; }

        [UIHint("TNLongText")]
        public string Description { get; set; }

        [UIHint("TNText")]
        public string Link { get; set; }

        [UIHint("TNText")]
        public string Icon { get; set; }

        [UIHint("TNCbo")]
        [AdditionalMetadata("ViewDataSelectList", "LstParent")]
        [Display(Name = "Parent")]
        public int? ParentId { get; set; }

        [UIHint("TNEnum")]
        [Display(Name = "Project Type")]
        public EnumProjectType ProjectType { get; set; }

        public virtual SysFeature Parent { get; set; }

        public virtual ICollection<SysFeature> Childrens { get; set; }

        [UIHint("TNCheckBox")]
        [Display(Name = "Display On Nav")]
        public bool IsDisplayOnNav { get; set; }

        [UIHint("TNSmallText")]
        [Display(Name = "Display Order")]
        public int? DisplayOrder { get; set; }

        [UIHint("TNCheckBox")]
        [Display(Name = "Is Active")]
        public bool IsActive { get; set; }

        public virtual ICollection<SysRole> SysRoles { get; set; }

        // extension

        [NotMapped]
        [ScaffoldColumn(false)]
        [Display(Name = "Total Children")]
        public int TotalChildren { get; set; }
    }
}
